import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/home.vue'
import Index from '@/views/index.vue'
import Cla from '@/views/cla.vue'
import Cart from '@/views/cart.vue'
import My from '@/views/my.vue'
import Baby from '@/views/baby.vue'
import Register from '@/views/register.vue'
import Login from '@/views/login.vue'
import Detail from '@/views/detail.vue'
import List from '@/views/list.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/home/index' },
    {
      path: '/home',
      name: 'home',
      component: Home,
      children: [{
        path: 'index',
        name: 'index',
        component: Index,
      },
      {
        path: 'cla',
        name: 'cla',
        component: Cla,
      },
      {
        path: 'baby',
        name: 'baby',
        component: Baby,
      },
      {
        path: 'cart',
        name: 'cart',
        component: Cart,
      },
      {
        path: 'my',
        name: 'my',
        component: My,
      },
      ]
    },
    {
      path:'/register',
      name:'register',
      component:Register,
    },
    {
      path:'/login',
      name:'login',
      component:Login,
    },
    {
      path:'/detail/:goods_id',
      name:'detail',
      component:Detail,
    },
    {
      path:'/list/:query',
      name:'list',
      component:List,
    },


  ],
})

export default router
